<template>
	<view class="contain u-content">
		<view class="w-[100%] text-center mt-2 big blod">{{title}}</view>
		<view class="w-[100%] text-center mt-2 small gray">发布于:{{time}}</view>
		<view class="mt-2"><u-parse :content="content" :tagStyle="style"></u-parse></view>
	</view>
</template>

<script setup lang='ts'>
import { ref,reactive } from 'vue'
import {  onLoad,onShow } from '@dcloudio/uni-app'

let articleType=ref("课程介绍");

//let content=ref(`<p>露从今夜白，月是故乡明</p><img src="https://cdn.uviewui.com/uview/swiper/2.jpg" />`);
let title=ref('');
let time=ref('');
let content=ref('');
let style=reactive({
	// 字符串的形式
	p: 'color: red;font-size:32rpx; line-height:50rpx; margin-bottom:5px !important;',
	span: 'font-size: 30rpx'
})

onLoad((e:any)=>{
	// if(e.aType!=null){
	// 	console.log("文章内容",e.aType);
	// 	getArticles(e.aType);
	// 	uni.setNavigationBarTitle({
	// 		title:e.aType
	// 	})
	// }
});

onShow(()=>{
	if(uni.getStorageSync("articleDetail")!=null){
		let data=uni.getStorageSync("articleDetail");
		title.value=data.atitle;
		time.value=data.createtime;
		content.value=data.acontent;
	}
}); 


/* 获取文章 */
// const getArticles=(articleType:string)=>{
// 	let paraData={
// 		atype:articleType
// 	}
// 	uni.$tools.Reqeust('/api/getArticles',paraData,'POST').then((res:any)=>{
// 		console.log('获取文章结果:==>',res);
// 		if (res.data.code == 200) {
// 			uni.hideLoading();
// 			content.value=res.data.data.bodydata;
// 		}else{
// 			uni.hideLoading();
// 		}
// 	})	
// }


</script>
<style lang='scss' scoped>
	@import "article.scss";
	.u-content {
		padding: 24rpx;
	}
</style>